#include<iostream.h> // 7 minutes in completion
#include<conio.h>
#include<algorithm>
using namespace std;
int main()
{
    int givenArr[] = {1,2,3};
    int len = sizeof(givenArr)/sizeof(int);
    cout<<"\n anagram of the given array\n";
    sort(givenArr, givenArr+len);
    do
    {
         for(int i=0; i<len; i++)
             cout<<" "<<givenArr[i];
         cout<<"\n";
    }while(next_permutation(givenArr, givenArr+len));
    
    getch();
    return 0;
}
